
/*****************************************************************************
 *
 * 作   者: 马婷婷 * 创建时间: 2020/12/15 15:56:49 *
 * Copyright (C) 2008 - 鹏业软件公司
 *
 *****************************************************************************/

import {DataPacket, NorDataList} from 'pengesoft-ng-lib';

/**
 * 员工
 */
export class Employee extends DataPacket {
  Id: string; // 员工id
  JobId: string; // 岗位id
  Name: string; // 姓名
  Sex: number; // 性别
  ArchivesNum: string; // 档案号
  ArchivesFile: string; // 档案文件
  EmployForm: string; // 用工形式
  StateId: string; // 当前状态id
  EmployeeDay: number; // 职业工龄
  GraduatedSchool: string; // 毕业院校
  StudyMajor: string; // 所学专业
  EducationLevel: string; // 文化程度
  GraduatedTime: Date | string; // 毕业时间
  NativePlace: string; // 籍贯
  IDCard: string; // 身份证号码
  Birth: Date | string; // 生日
  Age: number; // 年龄
  Phone: string; // 联系电话
  EmergencyPeople: string; // 紧急联系人
  EmergencyContact: string; // 紧急联系电话
  HouseholdType: string; // 户籍类型
  IDPlace: string; // 身份证地址
  NowPlace: string; // 现住地址
  Politic: string; // 政治面貌
  CardNum: string; // 银行卡号
  CardType: string; // 银行卡类型
  CardAddress: string; // 银行卡地址
  ExtAttr: string; // 其他字段

  constructor(options: {
    Id?: string;
    JobId?: string;
    Name?: string;
    Sex?: number;
    ArchivesNum?: string;
    ArchivesFile?: string;
    EmployForm?: string;
    StateId?: string;
    EmployeeDay?: number;
    GraduatedSchool?: string;
    StudyMajor?: string;
    EducationLevel?: string;
    GraduatedTime?: Date | string;
    NativePlace?: string;
    IDCard?: string;
    Birth?: Date | string;
    Age?: number;
    Phone?: string;
    EmergencyPeople?: string;
    EmergencyContact?: string;
    HouseholdType?: string;
    IDPlace?: string;
    NowPlace?: string;
    Politic?: string;
    CardNum?: string;
    CardType?: string;
    CardAddress?: string;
    ExtAttr?: string;
  } = {}) {
    super();
    this.Id = options.Id || '';
    this.JobId = options.JobId || '';
    this.Name = options.Name || '';
    this.Sex = !options.Sex ? 0 : Number.parseFloat(options.Sex.toString());
    this.ArchivesNum = options.ArchivesNum || '';
    this.ArchivesFile = options.ArchivesFile || '';
    this.EmployForm = options.EmployForm || '';
    this.StateId = options.StateId || '';
    this.EmployeeDay = !options.EmployeeDay ? 0 : Number.parseFloat(options.EmployeeDay.toString());
    this.GraduatedSchool = options.GraduatedSchool || '';
    this.StudyMajor = options.StudyMajor || '';
    this.EducationLevel = options.EducationLevel || '';
    this.GraduatedTime = this.newDate(options.GraduatedTime);
    this.NativePlace = options.NativePlace || '';
    this.IDCard = options.IDCard || '';
    this.Birth = this.newDate(options.Birth);
    this.Age = !options.Age ? 0 : Number.parseFloat(options.Age.toString());
    this.Phone = options.Phone || '';
    this.EmergencyPeople = options.EmergencyPeople || '';
    this.EmergencyContact = options.EmergencyContact || '';
    this.HouseholdType = options.HouseholdType || '';
    this.IDPlace = options.IDPlace || '';
    this.NowPlace = options.NowPlace || '';
    this.Politic = options.Politic || '';
    this.CardNum = options.CardNum || '';
    this.CardType = options.CardType || '';
    this.CardAddress = options.CardAddress || '';
    this.ExtAttr = options.ExtAttr || '';
  }
}

/**
 * 员工列表
 */
export class EmployeeList extends NorDataList<Employee> {

  constructor(options: {
    _Items?: Array<Employee>
  } = {}) {
    super();
    if (options._Items) {
      for (const item of options._Items) {
        this.append(new Employee(item));
      }
    }
  }
}
